namespace RAYTRACING {
    /** 程序入口 */
    export class Application {
        private _canvas: HTMLCanvasElement;
        private _painter: Painter;
        private _scene: Scene;
        constructor(canvas: HTMLCanvasElement, w: number = 512, h: number = 512) {
            this._canvas = canvas;
            this._painter = new Painter(canvas.getContext("2d"));
            this._scene = new Scene(this);
            this.setCanvasSize(w, h);
        }

        /**
         * 设置canvas 尺寸
         * @param width 
         * @param height 
         */
        public setCanvasSize(width: number, height: number) {
            this._canvas.width = width;
            this._canvas.height = height;
        }


        /** 获取绘制器 */
        public get painter() { return this._painter; }

        /** 场景 */
        public get scene() { return this._scene; }

        public get width() { return this._canvas.width; }
        public get height() { return this._canvas.height; }
        /** 宽比高的值 */
        public get asp() { return this._canvas.width / this._canvas.height; }

    }
}